<?php
$id = $_GET['id'];
$name = $_GET['name'];
$price = $_GET['price'];
$num = $_GET['num'];

$con = mysqli_connect('localhost', 'root', 'root');
mysqli_select_db($con, '2004');
mysqli_query($con, "set charset 'utf8'");
mysqli_query($con, "set character set 'utf8'");
$sql = "update shop set name = '$name',price = $price,num = $num where id = $id";
$resp = mysqli_query($con,$sql);
if($resp){
    echo json_encode(array(
        "code" => 200,
        "body" => array(
            "msg" => "更改成功"
        )
        ));
}else{
   echo json_encode(array(
       "code" => 0,
       "body" => array(
           "msg" => "更改失败"
       )
       ));
}
?>